<template>
  <view class="my-order">
    <view class="acea-row nav">
      <view :class="{on: status == ''}" class="acea-row row-center-wrapper" @click="tab('')">全部</view>
      <view :class="{on: status == 1}" class="acea-row row-center-wrapper" @click="tab(1)">待付款</view>
      <view :class="{on: status == 2}" class="acea-row row-center-wrapper" @click="tab(2)">已付款</view>
      <view :class="{on: status == 3}" class="acea-row row-center-wrapper" @click="tab(3)">退款</view>
    </view>
    <view class="list">
      <view v-for="(item,index) in dataList" :key="index" class='item'>
        <view @click="goDetails(item)">
          <view class='title acea-row row-between-wrapper'>
            <view class="acea-row row-middle left-wrapper">
              订单号 {{ item.order_sn }}
            </view>
            <view class='font-color'>
              <text v-if="item.status == 1">已付款</text>
              <text v-if="item.status == 0">待付款</text>
            </view>
          </view>
          <view class='item-info acea-row row-between row-top'>
            <view class='pictrue'>
              <image :src='item.thumb'></image>
            </view>
            <view class='text acea-row row-between'>
              <view class='name line2'>{{ item.title }}</view>
              <view class='money'>
                <view>￥{{ item.pay_money }}</view>
              </view>
            </view>
          </view>
          <view class='bottom acea-row  row-middle'>
            <text>下单时间：{{ item.add_time | formatDate }}</text>
            <view style="flex: 1;"></view>
            <view v-if="item.status == 1 && item.refund_order == 0" class='bnt cancelBnt'>退款</view>
            <view v-if="item.status == 0 && showBuy" class='bnt bg-color'>立即付款</view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import dataList from "@/mixins/dataList";
import {activityRefundOrder, userActivityList} from "@/api/2_activity";
const app = getApp()
export default {
  name: 'activity-order-list',
  mixins: [dataList],
  data() {
    return {
      status: '',
      showBuy: app.globalData.temp_status != 1
    }
  },
  onLoad() {
    this.setDataListReq(userActivityList)
    this.getDataList()
  },
  methods: {
    tab(status) {
      this.status = status
      this.resetDataList()
      this.setDataListPar({status: this.status})
      this.getDataList()
    },
    goDetails(item) {
      uni.navigateTo({
        url: `/pages/2_development/user/activity_order_details?item=${JSON.stringify(item)}&refund_msg=${JSON.stringify(this.refund_msg)}`
      })
    },


  }
}
</script>

<style lang="scss">
@import "./order-list.scss";
</style>